import axios from './axios'
import qs from 'qs'


export function getQuotationNo() {
    return axios.get('/spare_quotation/manage/get_spare_quotation_no.do').then(res=>Promise.resolve(res.data),err=>Promise.reject(err))
}

export function saveQuotation({quotationNo,quotationDateStr,quotationBy,customer,quotationDetail}) {
    return axios.post('/spare_quotation/manage/save_spare_quotation.do',qs.stringify({quotationNo,quotationDateStr,quotationBy,customer,quotationDetail}))
        .then(res=>Promise.resolve(res.data))
}

export function getQuotationList() {
    return axios.get('/spare_quotation/manage/get_spare_quotation_list.do').then(res=>Promise.resolve(res.data),err=>Promise.reject(err))
}

export function getQuotationDetail(quotationId) {
    return axios.post('/spare_quotation/manage/get_spare_quotation_detail.do',qs.stringify({quotationId})).then(res=>Promise.resolve(res.data),err=>Promise.reject(err))
}

export function confirmQuotation({quotationNo,quotationDateStr,quotationBy,customer,quotationDetail}) {
    return axios.post('/spare_quotation/manage/confirm_spare_quotation.do',qs.stringify({quotationNo,quotationDateStr,quotationBy,customer,quotationDetail}))
        .then(res=>Promise.resolve(res.data))
}


export function getInformationList() {
    return axios.get('/customer_information_collection/select_information.do').then(res=>Promise.resolve(res.data))
}

export function collectInfo({
                                recordInformation,
                                companyName,
                                contacts,
                                contactNumber,
                                address,
                                createTime,
                                recordTitle
                            }) {
    const data = qs.stringify({
        recordInformation,
        companyName,
        contacts,
        contactNumber,
        address,
        createTime,
        recordTitle});
    return axios.post('/customer_information_collection/save_information.do',data).then(res=>Promise.resolve(res.data));
}